using Core;
using IglooCoder.Commons.WcfNhibernate;
using System.Collections ;
using System.Collections.Generic ;
using Infrastructure;
using NHibernate.Mapping;


namespace Infrastucture
{
    public class CustomerRepository : BaseNHibernateRepository<Customer>
    {
        public CustomerRepository(ISessionStorage sessionStorage) : base(sessionStorage)
        {
        }


       

        public void InsertRange(List<Customer> customers)
        {
            object result = null;
            using (var tx = Session.BeginTransaction())
            {
                foreach (var customer in customers)
                {
                    if (Session.Get(typeof(Customer),customer.CustomerId) == null)
                             Session.Save(customer);
                }
                    
                tx.Commit();
            }
        }
    }
}